package bstsetcode;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/13 18:46
 */
public class SelectionSortTest2 {

    public SelectionSortTest2() {
    }

    public static void sort(int[] data){

        for (int i = 0; i < data.length; i++) {
            int minIndex = i;
            for (int j = i; j < data.length; j++) { // 从i开始
                if(data[j] < data[minIndex]){
                    minIndex = j;
                }
            }
            exchange(data,i,minIndex);

        }

    }

    private static void exchange(int[] data, int i, int j) {
        int temp = data[i];
        data[i] =data[j];
        data[j] = temp;
    }



    public static void main(String[] args) {

        //测试1W和10W的选择排序的时间性能
        int[] dataSize={10000,100000};
        for(int n:dataSize){
            Integer[] arr = ArrayGenerator.generateRandomArray(n,n);
//            SortHelper.sortTest("SelectionSortT",arr);
            SortHelper.sortTestReflect("code.SelectionSortT",arr);
        }


    }


}
